package com.cuanbo.dualscreenteachzhu.receiver;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MyReceiver extends android.content.BroadcastReceiver {
    private MyReceiverListener listener;

    public MyReceiver(MyReceiverListener listener){
        this.listener=listener;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if(listener==null)return;
        if(intent.getAction().equals("com.cuanbo.dralscreenteachzhu.action")){
            int type=intent.getIntExtra("type",0);
            Log.i("luohao","type="+type);
            if(type==0){
                listener.hdmi();
            }else if(type==1){
                listener.drawBoard();
            }else if(type==2){
                listener.comment();
            }else if(type==3){
                listener.sign();
            }else if(type==4){
                listener.closeSign();
            }else if(type==5){
                listener.capture();
            }else if(type==6){
                listener.showHdmi();
            }else if(type==7){
                listener.compare();
            }else if(type==8){
                String fileName=intent.getStringExtra("data");
                listener.compareImg1(fileName);
            }else if(type==9){
                String fileName=intent.getStringExtra("data");
                listener.compareImg2(fileName);
            }else if(type==10){
                listener.startRecordingVideo();
            }else if(type==11){
                listener.stopRecordingVideo();
            }else if(type==12){
                String path=intent.getStringExtra("data");
                listener.playVideo(path);
            }else if(type==13){
                listener.closeVideo();
            }
        }
    }

    public interface MyReceiverListener{
        void drawBoard();
        void comment();
        void hdmi();
        void sign();
        void closeSign();
        void capture();
        void showHdmi();
        void compare();
        void compareImg1(String fileName);
        void compareImg2(String fileName);

        void startRecordingVideo();

        void stopRecordingVideo();
        void playVideo(String path);
        void closeVideo();
    }
}
